package com.wuyan.locationdog

import com.amap.api.maps.MapsInitializer
import com.amap.api.services.core.ServiceSettings
import com.arcsoft.commonbase.BaseApplication
import com.arcsoft.commonbase.constant.Constants
import com.blankj.utilcode.util.SPUtils
import com.umeng.commonsdk.UMConfigure


class MyApplication : BaseApplication() {

    override fun initConfig() {
        //隐私同意后做的初始化
        if (SPUtils.getInstance().getBoolean(Constants.SP_IS_AGREE_PRIVACY, false)) {
            agreePrivacyAfterInit()
        }


        //设置LOG开关，默认为false
        UMConfigure.setLogEnabled(true)
        //友盟预初始化
        //友盟预初始化
        UMConfigure.preInit(applicationContext, "66275459c8e5d87362052b3d", "Umeng")


    }

    companion object {
        fun agreePrivacyAfterInit() {
            MapsInitializer.updatePrivacyShow(context, true, true);
            MapsInitializer.updatePrivacyAgree(context, true);
            ServiceSettings.updatePrivacyShow(context, true, true);
            ServiceSettings.updatePrivacyAgree(context, true);


            //友盟正式初始化
            val umInitConfig = UmInitConfig()
            umInitConfig.UMinit(context)
        }
    }
}


